The combination of mutual exclusion and memory barriers means that as long as programs follow the correct synchronization rules that is , synchronize whenever writing a variable that may next be read by another thread or when reading a variable that may have been last written by another thread , each thread will see the correct value of any shared variables it uses 互斥獨(dú)占和內(nèi)存壁壘結(jié)合使用意味著只要您在程序設(shè)計(jì)的時(shí)候遵循正確的同步法則(也就是說,每當(dāng)寫一個(gè)后面可能被其他線程訪問的變量,或者讀取一個(gè)可能最后被另一個(gè)線程修改的變量時(shí),都要使用同步) ,每個(gè)線程都會(huì)得到它所使用的共享變量的正確的值。